GCC = g++
CPPFLAGS = -g -finline-functions -Wall -Winline -pipe -DOS_LINUX
HEAD_INFO = -DPROJECT_NAME="\"FASTSEARCH\"" -DDESCRIPTION="\"FastSearch indexer\""
PB_PATH=../../../common/protobuf
	  
INCLUDES = -I./ \
		   -I$(PB_PATH)/include \

LIBS     = -L./ \
	       $(PB_PATH)/lib/libprotobuf.a \
	       -lpthread

all : libsearchpb.a
	  mkdir -p output/include
	  mkdir -p output/lib
	  cp *.h output/include
	  cp *.a output/lib

libsearchpb.a:	merge_list.pb.o query_info.pb.o
	$(AR) -crv $@ $^

%.o : %.cc
	$(GCC) $(CPPFLAGS) $(HEAD_INFO) -c $< -o $@ $(INCLUDES)

merge_list.pb.cc :
		    $(PB_PATH)/bin/protoc -I=./ --cpp_out=./ merge_list.proto
query_info.pb.cc :
	        $(PB_PATH)/bin/protoc -I=./ --cpp_out=./ query_info.proto

clean :
	rm -f *.o
	rm -rf *.a
	rm -rf *.pb.*
	rm -rf output
